//
//  WmcLeftTextRightImgBtn.swift
//  YPWatermarkCamera
//
//  Created by 赵新 on 2022/3/22.
//

import UIKit

class WmcLeftTextRightImgBtn: WmcImgTextControl {
    override func config() {
        label.textAlignment = .center
    }

    /// 进行布局
    override func layoutImgText() {
        label.snp.remakeConstraints { make in
            make.top.equalTo(contentEdge.top)
            make.left.equalTo(contentEdge.left)
            make.bottom.equalTo(-contentEdge.bottom)
            if let _ = imgSize {
                make.right.equalTo(imageView.snp.left).offset(imgTextSpacing)
            }
        }

        imageView.snp.remakeConstraints { make in
            make.top.equalTo(contentEdge.top)
            make.right.equalTo(-contentEdge.right)
            make.bottom.equalTo(-contentEdge.bottom)
            if let imgSize = imgSize {
                make.width.equalTo(imgSize)
            } else {
                make.left.equalTo(label.snp.right).offset(imgTextSpacing)
            }
        }
    }
}
